# -*- coding:utf-8 -*-
"""
@author: fsksf

@since: 2022/3/23 16:33
"""
from typing import Dict, List, Optional, Callable
from vcat.core.event import (
    Event, EventType
)
from vcat.core.constant import (
    HandlerLevel,
    WhenHandlerError,
    HandlerCategory
)

from vcat.core.obj import (
    BarData,
    BarGenArrayParams,
    TickData,
    OrderRequest,
    OrderData,
    TradeData,
    ContractData,
    PositionData
)


class ApiStore:
    """
    api聚集类，不允许实例化，需要用到的api要注入到此处
    """

    def __new__(cls, *args, **kwargs):
        raise NotImplementedError

    def as_left_handler(self,
                        category: HandlerCategory,
                        event_type: EventType,
                        level: HandlerLevel,
                        error=WhenHandlerError.LOG):
        raise NotImplementedError

    def get_tick(self, cid) -> TickData:
        """
        获取最新价格
        :param cid: code.exchange.contract_type
        :return: TickData
        """
        raise NotImplementedError

    def get_position(self, pid) -> PositionData:
        """
        获取单个持仓
        :param pid: code.exchange.contract_type.direction
        :return: PositionData
        """
        raise NotImplementedError

    def get_all_positions(self) -> List[PositionData]:
        """
        获取持仓列表
        :return: List[PositionData]
        """
        raise NotImplementedError
